/*
 * Copyright 2005 罗阳
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.maywide.jdp.dao;


/**
 * 列表查询模板（可以设置排序字段、方式，显示页号、每页数量,以及查询的总记录）
 * 
 * @author 罗阳
 */
public class PageQueryTemplate extends QueryTemplate {
	/**
	 * 显示记录号
	 */
	protected int first = 0;

	/**
	 * 每页数记录，默认每页20条记录
	 */
	protected int limit = 20;
	
	/**
	 * 总数统计SQL
	 */
	protected String countQueryString = null;

	/**
	 * 
	 */
	public PageQueryTemplate(String queryString,String countQueryString) {
		super(queryString);
		this.countQueryString = countQueryString;
	}

	/**
	 * 
	 */
	public PageQueryTemplate(String queryString,String countQueryString,int first,int limit) {
		super(queryString);
		this.countQueryString = countQueryString;
		this.first = first;
		this.limit = limit;
	}

	/**
	 * 
	 */
	public PageQueryTemplate(String queryString,String countQueryString,int first,int limit,String sort,String dir) {
		super(queryString,sort,dir);
		this.countQueryString = countQueryString;
		this.first = first;
		this.limit = limit;
	}

	/**
	 * @return 返回 limit。
	 */
	public int getLimit() {
		return limit;
	}

	/**
	 * @param limit
	 *            The limit to set.
	 */
	public void setLimit(int limit) {
		this.limit = limit;
	}

	/**
	 * @return 返回 first。
	 */
	public int getFirst() {
		return first;
	}

	/**
	 * @param first
	 *            要设置的 first。
	 */
	public void setFirst(int first) {
		this.first = first;
	}

	public String getCountQueryString() {
		return countQueryString;
	}

	public void setCountQueryString(String countSql) {
		this.countQueryString = countSql;
	}
}
